package com.daiyang.blog.common.result;

import com.daiyang.blog.common.contants.Contants;
import lombok.Data;

@Data
public class Result<T> {
    private int code;
    private String msg;
    private T data;
    public static<T> Result<T> resultSuccess(T data) {
        Result<T> result = new Result<T>();
        result.setCode (Contants.RESULT_SUCCESS) ;
        result.setData(data);
        return result;
    }
    public static<T> Result <T>resultError (String msg) {
        Result<T> result = new Result<T>();
        result.setCode (Contants.RESULT_ERROR) ;
        result.setMsg (msg) ;
        return result;

    }
    public static<T>Result<T> resultError( String msg, T data) {
        Result<T> result = new Result<T>();
        result.setCode (Contants.RESULT_ERROR) ;
        result.setMsg (msg) ;
        result.setData (data) ;
        return result;
    }
}
